var xhr = null;
function createRequest() {
	if (window.ActiveXObject) {
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		xhr = new XMLHttpRequest();
	}
}

function sendRequest(url, param, callback, method) {
	createRequest();
	var httpMethod = (method != 'POST' && method != 'post') ? 'GET' : 'POST';
	var httpParam = (param == null || param == '') ? null : param;
	var httpURL = url;
	if ((httpMethod == 'GET') && httpParam != null)
		httpURL = httpURL + "?" + httpParam;
	xhr.onreadystatechange = callback;
	xhr.open(httpMethod, httpURL, true);
	xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr.send(httpMethod == 'POST' ? httpParam : null);
}
